package model.util;

import java.io.IOException;
import java.io.Reader;

import com.ibatis.common.resources.Resources;
import com.ibatis.sqlmap.client.SqlMapClient;
import com.ibatis.sqlmap.client.SqlMapClientBuilder;

public class DBUtil {
	private static SqlMapClient sqlMapper;
	static {
		Reader reader = null;
		try {
			reader = Resources.getResourceAsReader("conf/SqlMapConfig.xml");
			sqlMapper = SqlMapClientBuilder.buildSqlMapClient(reader);
			System.out.println("Success to excute Database");
		} catch (Exception e) {
			e.printStackTrace();
			System.out.println("Fail to excute Database");
		} finally {
			try {
				reader.close();
			} catch (IOException e) {
				System.out.println("Fail to excute Database");
			}
		}
	}

	public static SqlMapClient getParser() {
		return sqlMapper;
	}
}
